<template>
	<view class="product-card">
		<image :src="product.image" class="product-image" mode="aspectFill" />
		<view class="product-info">
			<text class="product-title">{{ product.desc }}</text>
			<view class="product-footer">
				<view class="likes">
					<view>
						<image src="/static/icon/like1.png" class="like-icon"></image>
					</view>
					<text class="like-count">{{ product.likes }}</text>
				</view>
				<text class="store-name">{{ product.storeName }}</text>
			</view>
		</view>
	</view>
</template>

<script setup lang="ts">
	import { Product } from '@/types/types'

	defineProps<{
		product:Product
	}>();
</script>

<style scoped lang="scss">
	.product-card {
		/* width: calc(50% - 0.5rem);
		/ margin: 0.25rem;*/
		width: 100%;
		border-radius: 0.75rem;
		background: #fff;
		overflow: hidden;
		box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
	}

	.product-image {
		width: 85%;
		height: 8rem;
		object-fit: cover;
		margin: 0.8rem 0.8rem 0 0.8rem;
		border-radius: 0.63rem;
	}

	.product-info {
		padding: 0.5rem;
	}

	.product-title {
		font-size: 0.875rem;
		color: #333;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		line-height: 1.2;
		margin-bottom: 0.5rem;
	}

	.product-footer {
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 0.75rem;
	}

	.likes {
		display: flex;
		align-items: center;
		gap: 0.25rem;
		.like-icon {
			width: 1rem;
			height: 1rem;
		}
		.like-count {
			color: #666;
			margin-top: -0.3rem;
		}
	}

	.store-name {
		color: #666;
		margin-top: -0.3rem;
		font-weight: 600;
	}
</style>